package linc.cool.framework;

import linc.cool.framework.protocol.dubbo.DubboProtocol;
import linc.cool.framework.protocol.http.HttpProtocol;
import org.apache.dubbo.common.utils.StringUtils;

/**
 * @author yqlin
 * @date 2022/3/11 6:26 下午
 * @description
 */
public class ProtocolFactory {
    public static Protocol getProtocol() {
        String protocolName = System.getProperty("protocolName");
        if (StringUtils.isBlank(protocolName)) {
            protocolName = "http";
        }
        switch (protocolName) {
            case "http":
                System.out.println("http协议");
                return new HttpProtocol();
            case "dubbo":
                System.out.println("dubbo协议");
                return new DubboProtocol();
            default:
                break;
        }
        System.out.println("http协议");
        return new HttpProtocol();
    }
}
